package com.wa.enums;
import com.wa.constants.ServiceTypeConstant;
import com.wa.constants.ServiceTypeNameConstant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author recharde.li@allchips.com
 * @version V1.0
 * @date 2020-05-28 09:41
 **/
public enum NameSpaceEnum {

    /**
     * 协同命名空间
     */
    BOM(ServiceTypeConstant.BOM,"/" + ServiceTypeNameConstant.BOM_NAME, ServiceTypeNameConstant.BOM_NAME),

    /**
     * 商城系统命名空间
     */
    WEBSITE(ServiceTypeConstant.WEBSITE,"/" + ServiceTypeNameConstant.WEBSITE_NAME, ServiceTypeNameConstant.WEBSITE_NAME),

    /**
     * 内部boss系统命名空间
     */
    BOSS(ServiceTypeConstant.BOSS, "/" + ServiceTypeNameConstant.BOSS_NAME, ServiceTypeNameConstant.BOSS_NAME),

    /**
     * 产品系统命名空间
     */
    PRODUCT(ServiceTypeConstant.PRODUCT,"/" + ServiceTypeNameConstant.PRODUCT_NAME, ServiceTypeNameConstant.PRODUCT_NAME),

    /**
     * bomsaas系统命名空间
     */
    BOM_SAAS(ServiceTypeConstant.BOM_SAAS,"/" + ServiceTypeNameConstant.BOM_SAAS_NAME, ServiceTypeNameConstant.BOM_SAAS_NAME);

    /**
     * 编码
     */
    private int code;

    /**
     * 英文编码
     */
    private String codeEn;

    /**
     * 中文编码
     */
    private String codeCn;

    private static final Map<Integer, NameSpaceEnum> lookup = new HashMap<Integer, NameSpaceEnum>();

    static {
        for (NameSpaceEnum ase : NameSpaceEnum.values()) {
            lookup.put(ase.getCode(), ase);
        }
    }

    private NameSpaceEnum(int code, String codeEn, String codeCn) {
        this.code = code;
        this.codeEn = codeEn;
        this.codeCn = codeCn;
    }

    public int getCode() {
        return code;
    }

    public String getCodeEn() {
        return codeEn;
    }

    public String getCodeCn() {
        return codeCn;
    }

    public static NameSpaceEnum get(Integer statusCode) {
        return lookup.get(statusCode);
    }

}
